const UserKey = 'UserKey'  //键
const TokenKey = 'TokenKey' //键

//Token保存在SeessionStorage 
export function getTokenLocal() {   //取数据
  return sessionStorage.getItem(TokenKey)
}
export function setTokenLocal(token) {  //存数据
  return sessionStorage.setItem(TokenKey, token)
}
export function removeTokenLocal() {   //清除数据
  return sessionStorage.removeItem(TokenKey)
}


//用户数据保存在LocalStorage
export function getUserLocal () {
  let user = localStorage.getItem(UserKey)
  return user ? JSON.parse(user) : {}
}
export function setUserLocal (user) {
  return localStorage.setItem(UserKey, JSON.stringify(user))
}
export function removeUserLocal () {
  return localStorage.removeItem(UserKey)
}